#include "coreserver.h"
#include "server/client.h"
#include "main.h"
#include "utils/Config.h"

CoreServer::CoreServer(QObject *parent) : QTcpServer(parent)
{
    QHostAddress addr(QString(SERVER_ADDR));
    if(!listen(addr, TCP_PORT))
    {
        _log->LogIt("Unable to start the TCP server",Logg::LERROR);
    }else{
        _log->LogIt("TCP Server ON");
    }
}
void CoreServer::incomingConnection(int socketDescriptor)
 {
     Client *thclient = new Client(socketDescriptor, this);
     connect(thclient, SIGNAL(finished()), thclient, SLOT(deleteLater()));
     thclient->start();
 }
